using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;

namespace WebApplication8.Data
{
  public class Question : AuditingEntityBase
  { 
    [Display(Name = "问题类型")]
    public QuestionType Type { get; set; } = QuestionType.单选题;
    [Display(Name = "标题")]
    public string Title { get; set; }
    [Display(Name = "图片")]
    public string ImgFileName { get; set; }
    [Display(Name = "内容")]
    public string Content { get; set; }
    public List<CourseQuestion> CourseQuestion { get; set; }
    public List<ChapterQuestion> ChapterQuestion { get; set; }

    [Display(Name = "总分")]
    public int TotalScore { get; set; } = 1;
        public string TeacherId { get; set; }
        [Display(Name = "教师")]
    public Teacher Teacher { get; set; }


    public string OptionText { get; set; }

    public string[] QuestionOptions => OptionText?.Split(new[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries);
    public string Remark { get; set; }
  }
  public class CourseQuestion : AuditingEntityBase
  {

        public string CourseId { get; set; }
        public Course Course { get; set; }
        public string QuestionId { get; set; }
        public Question Question { get; set; }
  }
  public class ChapterQuestion : AuditingEntityBase
  {

        public string ChapterId { get; set; }
        public Chapter Chapter { get; set; }
        public string QuestionId { get; set; }
        public Question Question { get; set; }
  }
  public enum QuestionType
  {
    单选题,
    多选题,
    简答题
  }


}
